﻿using System.Collections.Generic;
using winS.Unity.Process;

namespace winS.UnityEditor.ProcessEditor
{
    /// <summary>
    /// 只输入节点.
    /// 该节点自带一个输入端口
    /// </summary>
    public abstract class InputOnlyStepNode<T> : PortStepNode<T>, IInputable where T : class, IStep
    {
        public InputPort inputPort { get; protected set; }

        internal override void Initialize()
        {
            base.Initialize();
            portContainer.Add(inputPort = new InputPort(this));
            inputPort.style.marginBottom = inputPort.style.marginTop = 8f;
        }

        public override Connectionline RequestConnect(OutputPort outputPort)
        {
            return stepGraphView.ConnectPort(inputPort, outputPort);
        }

        IEnumerable<InputPort> IInputable.GetInputPorts()
        {
            yield return inputPort;
        }
    }
}